using System;
using System.Collections.Generic;
using System.Text;

using PickGold;
using PickGold.Database;
using DataCommon = PickGold.Database.Common;

namespace PickGold.Entities.Table
{
    public class CBaseEntityInfo : CBaseTable
    {
        //
        public const string ENTITY_NAME = "tb_sys_entity_info";
        public const string ENTITY_ALIAS = "entities";
		public const string ENTITY_KEY = DataCommon.ENTITY_ID;
		public const string ENTITY_SYMBOL = DataCommon.ENTITY_NAME;
        //
		public const string ITEM_MAX = "item_max";
		public const string ITEM_SIZE = DataCommon.ITEM_SIZE;
        public const string ITEM_ALIAS = "item_alias";
		public const string ITEM_SEQUENCE = "item_sequence";
		public const string SQL_SEQUENCE = "sql_sequence";
		public const string SQL_SUPER = "sql_super";
		public const string PROCESS_PLAN = "process_plan";
		public const string PROCESS_TIME = "process_time";
		public const string ITEM_NOTE = DataCommon.ITEM_NOTE;
        public const string ITEM_SQL = "item_sql";
        //
        private SBaseEntityInfo _ = null;
        //
        public CBaseEntityInfo() : base(ENTITY_NAME, ENTITY_ALIAS) { }
        public CBaseEntityInfo(CDatabase db) : base(db, ENTITY_NAME, ENTITY_ALIAS) { }
        public CBaseEntityInfo(string alias) : base(ENTITY_NAME, alias) { }
        public CBaseEntityInfo(CDatabase db, string alias) : base(db, ENTITY_NAME, alias) { }
        //
        protected override void SetSchema()
        {
            this.SetSchema(new SBaseEntityInfo());
        }
        protected void SetSchema(SBaseEntityInfo s)
        {
            this._ = s;
            base.SetSchema(s);
        }
        //
        protected override void PreInitSchema()
        {
            base.PreInitSchema();
            this._DataTable.Columns.Add(ITEM_MAX, typeof(int)).DefaultValue = this._.ItemMax;
            this._DataTable.Columns.Add(ITEM_SIZE, typeof(int)).DefaultValue = this._.ItemSize;
            this._DataTable.Columns.Add(ITEM_ALIAS, typeof(string)).MaxLength = 50;
            this._DataTable.Columns.Add(ITEM_SEQUENCE, typeof(long)).DefaultValue = this._.ItemSequence;
            this._DataTable.Columns.Add(SQL_SEQUENCE, typeof(string)).MaxLength = 1024;
            this._DataTable.Columns.Add(SQL_SUPER, typeof(string)).MaxLength = 1024;
            this._DataTable.Columns.Add(PROCESS_PLAN, typeof(DateTime)).DefaultValue = this._.ProcessPlan;
            this._DataTable.Columns.Add(PROCESS_TIME, typeof(DateTime)).DefaultValue = this._.ProcessTime;
            this._DataTable.Columns.Add(ITEM_NOTE, typeof(string)).MaxLength = 50;
            this._DataTable.Columns.Add(ITEM_SQL, typeof(string)).MaxLength = 2048;
        }
        //
        #region Property
		//
		public int ItemMax
		{
			set
			{
				this._.ItemMax = value;
				this.SetValue(ITEM_MAX, value);
			}
			get
			{
				return this._.ItemMax;
			}
		}
		//
		public int ItemSize
		{
			set
			{
				this._.ItemSize = value;
				this.SetValue(ITEM_SIZE, value);
			}
			get
			{
				return this._.ItemSize;
			}
		}
        //
        public string ItemAlias
        {
            set
            {
                this._.ItemAlias = value;
                this.SetValue(ITEM_ALIAS, value);
            }
            get
            {
                return this._.ItemAlias;
            }
        }
		//
		public long ItemSequence
		{
			set
			{
				this._.ItemSequence = value;
				this.SetValue(ITEM_SEQUENCE, value);
			}
			get
			{
				return this._.ItemSequence;
			}
		}
		//
		public string SqlSequence
		{
			set
			{
				this._.SqlSequence = value;
				this.SetValue(SQL_SEQUENCE, value);
			}
			get
			{
				return this._.SqlSequence;
			}
		}
		//
		public string SqlSuper
		{
			set
			{
				this._.SqlSuper = value;
				this.SetValue(SQL_SUPER, value);
			}
			get
			{
				return this._.SqlSuper;
			}
		}
		//
		public DateTime ProcessPlan
		{
			set
			{
				this._.ProcessPlan = value;
				this.SetValue(PROCESS_PLAN, value);
			}
			get
			{
				return this._.ProcessPlan;
			}
		}
		//
		public DateTime ProcessTime
		{
			set
			{
				this._.ProcessTime = value;
				this.SetValue(PROCESS_TIME, value);
			}
			get
			{
				return this._.ProcessTime;
			}
		}
        //
        public string ItemNote
        {
            set
            {
                this._.ItemNote = value;
                this.SetValue(ITEM_NOTE, value);
            }
            get
            {
                return this._.ItemNote;
            }
        }
        //
        public string ItemSql
        {
            set
            {
                this._.ItemSql = value;
                this.SetValue(ITEM_SQL, value);
            }
            get
            {
                return this._.ItemSql;
            }
        }
        //
        #endregion
        //
        public override bool MoveTo(int position)
        {
            if (!base.MoveTo(position))
                return false;
			this._.ItemMax = this.GetValue<int>(ITEM_MAX);
			this._.ItemSize = this.GetValue<int>(ITEM_SIZE);
            this._.ItemAlias = this.GetValue<string>(ITEM_ALIAS);
			this._.ItemSequence = this.GetValue<long>(ITEM_SEQUENCE);
			this._.SqlSequence = this.GetValue<string>(SQL_SEQUENCE);
			this._.SqlSuper = this.GetValue<string>(SQL_SUPER);
			this._.ProcessPlan = this.GetValue<DateTime>(PROCESS_PLAN);
			this._.ProcessTime = this.GetValue<DateTime>(PROCESS_TIME);
            this._.ItemNote = this.GetValue<string>(ITEM_NOTE);
            this._.ItemSql = this.GetValue<string>(ITEM_SQL);
            return true;
        }
        //
    }
    //
    public class SBaseEntityInfo : SBaseTable
    {
        //
		public int ItemMax = 0;
		public int ItemSize = 0;
        public string ItemAlias = null;
		public long ItemSequence = -1;
		public string SqlSequence = null;
		public string SqlSuper = null;
		public DateTime ProcessPlan = DateTime.MinValue;
		public DateTime ProcessTime = DateTime.MinValue;
        public string ItemNote = null;
        public string ItemSql = null;
        //
    }
    //
}
//
